<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="${staticServer}/inc/style/main.css"/>
    <link rel="stylesheet" href="${staticServer}/inc/style/page.css"/>
    <link rel="stylesheet" href="${staticServer}/css/work_today.css"/>
    <link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css"/>
    <script src="${staticServer}/inc/js/jquery.js"></script>
    <script src="${staticServer}/inc/js/pageset.js"></script>
    <script src="${staticServer}/inc/js/submitter.js"></script>
    <script src="${staticServer}/inc/js/tips.js"></script>
    <script src="${staticServer}/js/web/consultant_client_tracking_list.js?1.0"></script>

    <link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css"/>
    <script src="${staticServer}/inc/js/datepicker.js"></script>
    <script>
        var contextPath = '${contextPath}';

        $(function () {
            $("#center").val("${center}");
            
        });

        function submit() {
            var center = $("#center").val();
            var goodsId = $("#pratin").val();
            window.location.href = "${contextPath}/goods/Goods.htm?goodsId=" + goodsId + "&center=" + center;

        }
        function storage(flag) {
            if (flag == 1) {
                if (${total2}=="0") {
                    alert("暂时未有可以入库的物品!")
                    return false;
                }
            } else if (flag == 2) {
                if (${total3}=="0") {
                    alert("暂时未有可以出库的物品!")
                    return false;
                }
            }
            if (flag == 3) {
                window.location.href = "${contextPath}/goods/centralDistribution.htm";
            } else {
                window.location.href = "${contextPath}/goods/goodsStorage.htm?flag=" + flag;
            }
        }

        function getKeyDetail(id) {
            window.location.href = "${contextPath}/goods/getKeyDetail.htm?id=" + id;
        }

	$(function(){
	$("#good_mnus").change(function(){
		var good_mnus = $("#good_mnus").val();
	    $.post("${contextPath}/goods/goodsMnus.json", {
	    	"good_mnus" : good_mnus
		}, function(ms) {
	    	var list = ms.list;
	    	var objHtml="";
	    	$("#student").val("");
	    	for(var i=0;i<list.length;i++){
	    		objHtml +='<option value="'+list[i].id+'">'+list[i].name+'</option>';
	    	}
	    	$("#pratin").html(objHtml);
	    });

	})
});


    </script>
</head>

<body>
<input type="hidden" id="traId" value="">
<div id="home_link">
    <ul>
        <li></li>
        <li>&gt;</li>
        <li>采购管理</li>
        <li>&gt;</li>
        <li class="current">库存信息</li>
    </ul>
</div>
<div id="container">
    <div id="title">库存信息</div>
    <table class="simple_table" rel="nohover" style="min-width: 750px;">
        <tr>
            <td>
                <label for="phone">中心地址：</label>
                <select id="center">
                    <option value="">全部</option>
                <#if offList??>
                    <#list offList as list>
                        <option value="${list.name}">${list.name}</option>
                    </#list>
                </#if>
            </td>
            <td>
            	<label>物品类型：</label>
                <select id="good_mnus">
                <#if Mnuslist??>
                    <#list Mnuslist as list>
                        <option value="${list.id}">${list.name}</option>
                    </#list>
                </#if>
                </select>
                 <select id="pratin">
                        <option value="">请选择</option>
                </select>
            </td>    
            <td>
                <input type="button" value=" 查 询 " onclick="submit()"/>
                <input type="button" value=" 入 库 " onclick="storage(1)"/><label
                    style="color: red">可入库物品:(${total2})</label>
            <!--        
                <input type="button" value=" 出 库 " onclick="storage(2)"/><label
                    style="color: red">需出库物品:(${total3})</label>
              -->      
                <input type="button" value=" 中心分配" onclick="storage(3)"/>
            </td>
        </tr>
    </table>


    <table>

    <#if good_pard_id=="1">
        <tr class="fields">
            <th width="100">中心</th>
            <th width="100">物品名称</th>
            <th width="100">物品型号</th>
            <th width="100">编号/编码</th>
            <th width="100">用途</th>
            <th width="100">状态</th>
            <th width="100">备注</th>
            <th width="100">操作</th>
        </tr>
        <#if list??>
            <#list list as list>
                <tr class="even_row">
                    <td align="center">${list.center_name}</td>
                    <td align="center">${list.item_name}</td>
                    <td align="center">${list.model}</td>
                    <td align="center">${list.code}</td>
                    <td align="center">${list.purpose}</td>
                    <td align="center">${list.state}</td>
                    <td align="center">${list.msg}</td>
                    <td align="center"><a href="">编辑</a></td>
                </tr>
            </#list>
        </#if>
    <#elseif good_pard_id=="2">
        <tr class="fields">
            <th width="100">中心</th>
            <th width="100">物品名称</th>
            <th width="100">类型</th>
            <th width="100">资费</th>
            <th width="100">采购链接</th>
            <th width="100">使用地方</th>
            <th width="100">操作</th>
        </tr>
        <#if list??>
            <#list list as list>
                <tr class="even_row">
                    <td align="center">${list.center_name}</td>
                    <td align="center">${list.item_name}</td>
                    <td align="center">${list.broadband_type}</td>
                    <td align="center">${list.supplier}</td>
                    <td align="center">${list.purchasing_link}</td>
                    <td align="center">${list.msg}</td>
                    <td align="center"><a href="">编辑</a></td>
                </tr>
            </#list>
        </#if>
    <#elseif good_name_id=="3">
        <tr class="fields">
        	<th width="100">中心</th>
            <th width="100">中心名称</th>
            <th width="100">物品名称</th>
            <th width="100">物品数量</th>
            <th width="100">采购链接</th>
            <th width="100">操作</th>
        </tr>
        <#if list??>
            <#list list as list>
                <tr class="even_row">
                    <td align="center">${list.center_name}</td>
                    <td align="center">${list.center_name}</td>
                    <td align="center">${list.item_name}</td>
                    <td align="center">${list.number}</td>
                    <td align="center">${list.purchasing_link}</td>
                    <td align="center"><a href="">编辑</a></td>
                </tr>
            </#list>
        </#if>
	<#else>
		 <tr class="fields">
            <th width="150">办公地址</th>
            <th width="100">物品分类</th>
            <th width="100">物品名称</th>
            <th width="100">物品数量</th>
            <th width="100">物品单价</th>
            <th width="100">总额</th>
            <th width="100">物品单位</th>
            <th width="100">物品类型</th>
            <th width="100">状态</th>
            <th width="100">备注</th>
            <th width="100">操作</th>
        </tr>
    <#if list??>
        <#list list as list>
            <tr class="even_row">
                <td align="center">${list.center_name}</td>
                <td align="center">${list.goods_name}</td>
                <td align="center">${list.item_name}</td>
                <td align="center">${list.number}</td>
                <td align="center">${list.unit_price}</td>
                <td align="center">${list.total_calculation}</td>
                <td align="center">${list.company}</td>
                <td align="center">
                    <#if  list.type=="1">
                        	固定资产
                    <#elseif  list.type=="2">
                        	消耗品
                    </#if>

                </td>
                <td align="center">
                    <#if list.apply_status=="1">
                   			       未审核
                    <#elseif list.apply_status=="2">
                      		     审核待采购
                    <#elseif list.apply_status=="4">
                            	采购已审核
                    <#elseif list.apply_status=="5">
                      		     审核未通过
                    </#if>
                </td>
                <td>
                    <a title="${list.msg}">
                        <em class="caption"></em>
                        <#if list.msg?length gt 6>${list.msg?substring(0,5)}...<#else>${list.msg}</#if>
                    </a>
                </td>
                <td align="center">
                	<a href="${contextPath}/goods/addGoods.htm?id=${list.id}">查看</a>
                </td>
            </tr>
            </#list>
   	 	</#if>
    </#if>

    </table>
</div>

<div id="pager">
    <ul id="pagination" style="padding-left: 14px">
    <#if page??>
        <#if page.pagetotal?? && page.pagetotal!="0">
            <#assign pagetotal = page.pagetotal>
        <#else>
            <#assign pagetotal = 1>
        </#if>
        <#if page.currpage??>
            <#assign currpage = page.currpage>
        <#else>
            <#assign currpage = 1>
        </#if>
        <#if currpage==1 >
            <li class="previous-off">首页</li>
            <li class="previous-off">上一页</li>
        <#else>
            <li class="previous"><a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=1">首页</a>
            </li>
            <li class="previous"><a
                    href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${currpage-1}">上一页</a>
            </li>
        </#if>
        <input type="hidden" id="total" value="${page.pagetotal}"/>
        <#if pagetotal<=11>
            <#list 1..pagetotal as index_up>
                <#if currpage==index_up >
                    <li class="current">${index_up}</li>
                <#else>
                    <li>
                        <a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${index_up}">${index_up}</a>
                    </li>
                </#if>
            </#list>
        <#else>
            <#if currpage<=8 >
                <#list 1..9 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li>
                            <a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${index_up}">${index_up}</a>
                        </li>
                    </#if>
                </#list>
                <li>...</li>
                <li>
                    <a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${pagetotal}">${pagetotal}</a>
                </li>

            <#elseif (currpage>= 9 && currpage<pagetotal-7)  >
                <li><a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=1">1</a></li>
                <li>...</li>
                <#list currpage-3..currpage+3 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li>
                            <a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${index_up}">${index_up}</a>
                        </li>
                    </#if>
                </#list>
                <li>...</li>
                <li>
                    <a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${pagetotal}">${pagetotal}</a>
                </li>
            <#else>
                <li><a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&currPage=1&good_name_id=${good_name_id}">1</a></li>
                <li>...</li>
                <#list pagetotal-8..pagetotal as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li>
                            <a href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${index_up}">${index_up}</a>
                        </li>
                    </#if>
                </#list>
            </#if>
        </#if>
        <#if currpage==pagetotal >
            <li class="previous-off">下一页</li>
            <li class="previous-off">尾页</li>
        <#else>
            <li class="previous"><a
                    href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${currpage+1}">下一页</a>
            </li>
            <li class="previous"><a
                    href="${contextPath}/goods/goodsList.htm?center_name=${center_name}&good_name_id=${good_name_id}&currPage=${page.pagetotal}">尾页</a>
            </li>
        </#if>
        <li class="previous"></li>
        <li class="pageinfo">共${page.total}条记录</li>
    </#if>
    </ul>
</div>

<div class="emptyline"></div>
</body>
</html>